package com.nercel.dsj.gksales.util;

import java.util.Objects;
import java.util.function.BiConsumer;

/**
 * @author sunlin
 * @date 2019-3-10
 */
public class Iterables {

	public static <E> void forEach(
			Iterable<? extends E> elements, BiConsumer<Integer, ? super E> action) {
		Objects.requireNonNull(elements);
		Objects.requireNonNull(action);

		int index = 0;
		for (E element : elements) {
			action.accept(index++, element);
		}
	}

}
